-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Unity editor looping on Application.Shutdown.CleanupMono during shutdown. #1844
base: unity-main
Are you sure you want to change the base?
Fix Unity editor looping on Application.Shutdown.CleanupMono during shutdown. #1844
Conversation
Hello @blackcatrecycler thank you for the submission! I'm curious to see why the debugger thread was not exiting and therefore causing the hang. Have any bugs been submitted with the dumpfiles included? I'd like to investigate the issue myself a little if possible to see if there's anything else holding up the debugger thread that can be remedied. |
Hello @UnityAlex , I would be happy to provide dumpfiles, but please understand that our project has not been released yet. As for the Editorlog, there are no crash logs, the logs will only end with Cleanup mono. And besides that, there is no difference from the correct device. If you need dumpfiles, what method do I need to submit them using? |
@blackcatrecycler you can DM me on the forums: https://forum.unity.com/members/alex-thibodeau.254796/ -- with a link to where the dump files have been uploaded. |
I need to dig into this some more but as far as I can tell this should have been fixed by: 9987317 -- under this bug: https://issuetracker.unity3d.com/issues/after-launching-renderdoc-from-unity-cannot-close-unity-until-renderdoc-is-closed If you have a way for me to reproduce this that would be very helpful. The hang your observing should not be happening as far as I can tell. |
I'll try to reproduce it. As far as I know, the problems I observe can occur even in empty projects, which do not require renderdoc at all |
Hello @UnityAlex I conducted experiments on the device where the problem occurred. The version of Unity is 2021.3.5f1c1
√:can close |
I'd still like to be able to see this issue for myself. While this change would work for a shutdown scenario it does not work quite as well when flipping between debug & release JIT (the bug button in the bottom right corner). The act of re-jitting shuts down the debugger agent thread and restarts it. With this change we could potentially leave an active debugger thread alive and holding the socket when the new thread is started. The ideal fix is to sort out whatever the debugger thread is waiting on. |
@blackcatrecycler I'm happy to debug this issue if I can get it to reproduce locally. Is that possible or do I need some special hardware? |
It seems that some special version of win10 system could make this problem occur, because this issue is common among new colleagues or colleagues who reinstall the system. I will record it next time I go to work. |
Reviewers: please consider these questions as well! ❤️
Release notes
Fixed UUM-XXXXXX @blackcatrecycler:
Mono: Your release notes go here.
Many users on the forum have reported getting stuck at CleanupMono when closing UnityEditor, but no one has ever proposed a solution. When this issue occurs, the only way to close it is through the Task Manager. Recently, some members of our team have also experienced this issue. I analyzed the dump file and identified that the issue occurred in the
wait_for_debugger_thread_to_stop()
method. An indefinite wait is set here, but it seems that some machines are unable to exit the wait successfully.My current solution is to add a time limit to the wait, approximately 5 minutes. This method may not be very elegant, but it has helped more than 20 people resolve the issue on Unity versions from 2021.3 to 2022.3.
In the end, I think we should discuss the appropriate wait duration or the root cause of this issue.
Here are some examples from the forum:
Application.Shutdown.CleanupMono never finishes.
Application.Shutdown.CleanupMono infinite loop
How_to_time_the_CleanupMono_function_in_Unity3d
Backports
I believe this solution is applicable to Unity versions from 2020 onwards.